"""
Profiling pynchon.
"""
import numpy as np
import cProfile
import pstats
from pynchon.bio.aa import AA, AASeq, AAAln
from pynchon.core.symbol import Symbol0dS1, SymbolVector0dS1, SymbolArray0dS1

SYMBOLs_0 = 'A'
SYMBOLs_1 = "".join(['A' for i in xrange(1000)])

SYMBOL_0 = np.array('A',dtype='S1')
SYMBOL_1 = np.ndarray(shape=(1000,), dtype='S1')
SYMBOL_2  = np.ndarray(shape=(100,100), dtype='S1')
SYMBOL_1.fill('A')
SYMBOL_2.fill('A')

def print_stats(statsfile, delete =True):
    stats = pstats.Stats(statsfile)
    stats.sort_stats('cumulative')
    stats.print_stats()
    
def test_from_array():
    Symbol0dS1(SYMBOL_0)
    SymbolVector0dS1(SYMBOL_1)
    SymbolArray0dS1(SYMBOL_2)

def test_from_string():
    Symbol0dS1(SYMBOLs_0)
    SymbolVector0dS1(SYMBOLs_1) 

aaseqs = [AASeq(SYMBOLs_1, fast=True) for i in range(10)]    
def test_from_string_AA():
    a = AAAln(aaseqs, fast=True)
    print a.shape

    



if __name__ == '__main__':
    #cProfile.run("test_from_array()")
    #cProfile.run("test_from_string()")
    cProfile.run("test_from_string_AA()")
    #print_stats('/tmp/pynchon.profile')
    

